<%@ tag body-content="empty" description="InputDate Component" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%@ attribute name="id" rtexprvalue="true" type="java.lang.String" required="true" description="Id of component" %>
<%@ attribute name="defaultDate" rtexprvalue="true" type="java.lang.String" required="false" description="Id of component" %>
<%@ attribute name="inputStyle" rtexprvalue="true" type="java.lang.String" required="false" description="Style of input" %>
<%@ attribute name="buttonStyle" rtexprvalue="true" type="java.lang.String" required="false" description="Style of button" %>
<%@ attribute name="buttonText" rtexprvalue="true" type="java.lang.String" required="false" description="Style of button" %>
<%@ attribute name="buttonImage" rtexprvalue="true" type="java.lang.String" required="false" description="Image of button" %>
<%@ attribute name="onchange" rtexprvalue="true" type="java.lang.String" required="false" description="Onchange of input" %>
<%@ attribute name="readonly" rtexprvalue="true" type="java.lang.String" required="false" description="Onchange of input" %>

<c:choose>
<c:when test="${buttonImage != null}">
	<input type="text" name="${id}" id="${id}" value="${defaultDate}" onchange="${onchange}" 
		<c:if test="${empty readonly or readonly == 'false'}">
			onclick="showCalendar('${id}');"
		</c:if>
		style="${inputStyle}; background-image: url('${buttonImage}'); background-position: right; background-repeat: no-repeat; cursor: hand; "
		size="15" maxlength="10" readonly="readonly" />
</c:when>
<c:otherwise>
	<input style="${inputStyle}" name="${id}" id="${id}" type="text" 
		value="${defaultDate}" size="11" maxlength="10" readonly="readonly" onchange="${onchange}" />
	<c:if test="${empty readonly or readonly == 'false'}">
		<button style="${buttonStyle}" onclick="showCalendar('${id}');">${buttonText}</button>
	</c:if>
</c:otherwise>
</c:choose>